package com.jxc.model.po;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/***********************************************************************
 * Module:  Resource.java
 * Author:  Administrator
 * Purpose: Defines the Class Resource
 ***********************************************************************/

/**
 * 操作资源
 * 
 * @pdOid f1928e85-9d06-4c61-9769-30be8a18c4c5
 */
@Entity
@Table(name = "QXGL_RESOURCE")
public class Resource extends IdEntity implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -7289628390407513264L;
	/**
	 * 资源名称
	 * 
	 * @pdOid fc63b8c5-3bbb-4b2c-a5ba-d6a034c117cd
	 */
	private String name;
	/**
	 * 资源url
	 */
	private String url;
	/**
	 * 资源标识
	 * 
	 * @pdOid b51f5837-1e10-4f64-99f1-a76ab7e775c5
	 */
	private String sign;
	/**
	 * 上一级资源
	 * 
	 * @pdOid 55a7fcb0-72c0-4384-ab1d-1794de0e396a
	 */
	private Resource parent;
	/**
	 * 下级资源
	 * 
	 */
	private List<Resource> resources = new ArrayList<Resource>();

	@Column(name = "NAME")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "url")
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Column(name = "SIGN")
	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PARENT_ID")
	public Resource getParent() {
		return parent;
	}

	public void setParent(Resource parent) {
		this.parent = parent;
	}

	@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL)
	public List<Resource> getResources() {
		return resources;
	}

	public void setResources(List<Resource> resources) {
		this.resources = resources;
	}
}